<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:sec="http://www.springframework.org/security/tags"
	xmlns:p="http://primefaces.org/ui" template="/templates/main.xhtml">

	<ui:define name="metadata"></ui:define>

	<ui:define name="title">
		<h:outputText value="#{I18N.APP_TITLE}" />
	</ui:define>
	<ui:define name="top">
		<ui:include src="/snippets/top.xhtml" />
	</ui:define>
	<ui:define name="content">
		<div id="content">
			<div class="container-fluid">
				<div class="row-fluid">
					<h:form id="sweet_form">
						<h:panelGroup id="sweet_content" layout="block"
							styleClass="span12 juice-sweet">
							<div class="row-fluid">
								<h:panelGroup id="divtension" styleClass="span4">
									<h:outputLabel for="spinnertension" value="Tension délivrée" />
									<div class="input-append">
										<p:inputText value="#{C_SWEET.valueU}"
										readonly="#{C_SWEET.modeU}"
											styleClass="#{C_SWEET.valueU gt 6 ? 'span2 juice-warning' : 'span2'}"
											id="spinnertension">
											<f:convertNumber pattern="#0.00" />
											<p:ajax event="blur"
												update=":sweet_form:spinnerpuissance :sweet_form:spinnerpuissancespan :sweet_form:spinnerintensite :sweet_form:spinnerintensitespan :sweet_form:spinnerintensitedc :sweet_form:spinnerintensitedcspan :sweet_form:spinnertension :sweet_form:spinnertensionspan"
												process="@this" listener="#{C_SWEET.changeU}" />
										</p:inputText>
										<h:outputLabel id="spinnertensionspan"
											styleClass="#{C_SWEET.valueU gt 6 ? 'add-on juice-warning' : 'add-on'}"
											value="#{I18N.U_VOLT}" />
									</div>
								</h:panelGroup>
								<h:panelGroup id="divresistance" styleClass="span4">
									<h:outputLabel for="spinnerresistance" value="Resistance" />
									<div class="input-append">
										<p:inputText value="#{C_SWEET.valueO}" styleClass="span2"
											id="spinnerresistance">
											<f:convertNumber pattern="#0.00" />
											<p:ajax event="blur"
												update=":sweet_form:spinnertension :sweet_form:spinnertensionspan :sweet_form:spinnerpuissance :sweet_form:spinnerpuissancespan :sweet_form:spinnerintensite :sweet_form:spinnerintensitespan  :sweet_form:spinnerintensitedc :sweet_form:spinnerintensitedcspan"
												process="@this" listener="#{C_SWEET.changeO}" />
										</p:inputText>
										<h:outputLabel id="spinnerresistancespan" styleClass="add-on"
											value="#{I18N.U_OHM}" />
									</div>
								</h:panelGroup>
								<h:panelGroup id="divpuissance" styleClass="span4">
									<h:outputLabel for="spinnerpuissance" value="Puissance fournie" />
									<div class="input-append">
										<p:inputText value="#{C_SWEET.valueW}"
											readonly="#{C_SWEET.modeW}"
											styleClass="#{C_SWEET.valueW gt 20 ? 'span2 juice-warning' : 'span2'}"
											id="spinnerpuissance">
											<f:convertNumber pattern="#0.00" />
											<p:ajax event="blur"
												update=":sweet_form:spinnertension :sweet_form:spinnertensionspan :sweet_form:spinnerintensite :sweet_form:spinnerintensitespan :sweet_form:spinnerintensitedc :sweet_form:spinnerintensitedcspan :sweet_form:spinnerpuissance :sweet_form:spinnerpuissancespan"
												process="@this" listener="#{C_SWEET.changeW}" />
										</p:inputText>
										<h:outputLabel id="spinnerpuissancespan"
											styleClass="#{C_SWEET.valueW gt 20 ? 'add-on juice-warning' : 'add-on'}"
											value="#{I18N.U_WATT}" />
									</div>
								</h:panelGroup>
							</div>
							<div class="row-fluid">
								<h:panelGroup id="divchoice" styleClass="span4">
									<h:outputLabel for="spinnerchoice1" value="Mode" />
									<div class="input-append">
										<label class="checkbox">
										<h:selectBooleanCheckbox id="spinnerchoice1" value="#{C_SWEET.modeW}">
											<f:ajax immediate="true" execute="@this" render=":sweet_form:spinnerchoice2 :sweet_form:spinnertension :sweet_form:spinnerpuissance" listener="#{C_SWEET.changeMode}"/>
										</h:selectBooleanCheckbox>
										Calcul de puissance
										</label>
										<label class="checkbox">
										<h:selectBooleanCheckbox id="spinnerchoice2" value="#{C_SWEET.modeU}">
											<f:ajax immediate="true" execute="@this" render=":sweet_form:spinnerchoice1 :sweet_form:spinnertension :sweet_form:spinnerpuissance" listener="#{C_SWEET.changeMode}"/>
										</h:selectBooleanCheckbox>
										Calcul de tension
										</label>
									</div>
								</h:panelGroup>
								<h:panelGroup id="divintensite" styleClass="span4">
									<h:outputLabel for="spinnerintensite"
										value="Intensité délivrée" />
									<div class="input-append">
										<p:inputText value="#{C_SWEET.valueA}" readonly="true"
											styleClass="#{C_SWEET.valueA gt 4.0 ? 'span2 juice-warning' : 'span2'}"
											id="spinnerintensite">
											<f:convertNumber pattern="#0.00" />
										</p:inputText>
										<h:outputLabel id="spinnerintensitespan"
											styleClass="#{C_SWEET.valueA gt 4.0 ? 'add-on juice-warning' : 'add-on'}"
											value="#{I18N.U_AMP}" />
									</div>
									<h:outputLabel for="spinnerintensitedc"
										value="Intensité délivrée en Dual Coil" />
									<div class="input-append">
										<p:inputText value="#{C_SWEET.valueADC}" readonly="true"
											styleClass="#{C_SWEET.valueADC gt 2.0 ? 'span2 juice-warning' : 'span2'}"
											id="spinnerintensitedc">
											<f:convertNumber pattern="#0.00" />
										</p:inputText>
										<h:outputLabel id="spinnerintensitedcspan"
											styleClass="#{C_SWEET.valueADC gt 2.0 ? 'add-on juice-warning' : 'add-on'}"
											value="#{I18N.U_AMP}" />
									</div>
								</h:panelGroup>
							</div>
							<div class="row-fluid" style="margin-top: 40px;">
								<h:panelGroup id="divinfo" styleClass="span4">
									<p class="lead">
										<i class="icon-heart"></i> Calcul du sweet spot
									</p>
									<p>
									Choisir le mode de calcul en fonction de la valeur recherchée.
									</p>
									<p>
									<u>En mode calcul de puissance:</u>
									<br />
									Saisir la tension appliquée puis la valeur de la resistance vous donne la puissance fournie.
									</p>
									<p>
									<u>En mode calcul de tension:</u>
									<br />
									Saisir la puissance recherchée puis la valeur de la resistance vous donne la tension à appliquer.
									</p>
								</h:panelGroup>
								<h:panelGroup id="divexplain" styleClass="span6">
									<p class="lead">
										<i class="icon-warning-sign"></i> Valeurs anormales
									</p>
									<dl class="dl-horizontal">
										<dt>Tension appliquée > 6V</dt>
										<dd>Les mods delivrant plus de 6V ne sont pas légion</dd>
										<dt>Puissance délivrée > 20W</dt>
										<dd>Au dela de 20 Watts, autant sucer des piles</dd>
										<dt>Intensité délivrée > 4A</dt>
										<dd>Les résistances devraient claquer.</dd>
										<dt></dt>
										<dd>Les mods protégés coupent l'alimentation au dela de 3
											à 4 A</dd>
									</dl>
								</h:panelGroup>
							</div>
						</h:panelGroup>
					</h:form>
				</div>
			</div>
		</div>
	</ui:define>
	<ui:define name="footer">
		<ui:include src="/snippets/footer.xhtml" />
	</ui:define>
</ui:composition>
